home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1980-05-17 | 1.3 KB | 29 lines |
- '*****************YOU SPIN ME ROUND,ROUND-By Mark Wickson*********************
- Rem You may be wondering what a loop is.In computer terms it is a piece of
- Rem a program that constantly repeats itself.Why do you need something to
- Rem repeat itself?Well,imagine you had a game,and the player controlled a
- Rem Bob/Sprite's position with the joystick-Since you can't predict exactly
- Rem when the person is going to do anything and you would want the computer
- Rem to keep checking for any movement,you must use one of the many
- Rem "Loop" structures.Obviously,you can put anything that you want done
- Rem repeatedly in a loop-Remembering that the more you put into a loop,the
- Rem longer it takes to go through it.
- Rem This particular sort of loop uses the commands "Do" and "Loop".
- Rem When you want your loop to start,you type
- Rem Do
- Rem Then after this you put as many lines of program code as you
- Rem want-When you have all you want,type(On the start of a new line):
- Rem Loop
- Rem This makes the program return to the "Do" command written earlier,and then
- Rem start reading commands from there.
- Rem In our example,we display some text,make AMOS wait a fraction of a
- Rem second and then return to the start of the loop.
- Screen Open 0,320,256,4,Lowres
- Flash Off
- Curs Off
- Cls 0
- Paper 0
- Do
- Print "GOING DOWN!"
- Wait 5
- Loop